home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_sqd.cpp < prev    next >
C/C++ Source or Header  |  1996-03-19  |  20KB  |  620 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5.  
  6. #include "eurodefs.h"
  7. #include "euro_fxd.h"
  8. #include "euro.equ"
  9. #include "euro_sym.h"
  10. #include "euro_def.h"
  11. #include "euro_var.h"
  12. #include "euro_grf.h"
  13. #include "euro_dsk.h"
  14. #include "euro_gen.h"
  15. #include "euro_cnt.h"
  16. #include "euro_int.h"
  17.  
  18.  
  19. #include "defines.h"
  20.  
  21. void    RedrawSquadPanel();
  22. void    ReplaceSquadBuffers( char );
  23.  
  24.  
  25. //********************************************************************************************************************************
  26.  
  27. void    DisplayFormation( char AddToList )
  28.     {
  29.         int     ball, shadow, player, width, height;
  30.         float    x,y, snapx, shadx, shady;
  31.         float    yscale, xscale, ysize, xdiff, wthscale;
  32.         int    bscale;
  33.  
  34.  
  35.         
  36.     // *****  DISPLAY FORMATION TYPE AT FOOT OF SCREEN  ******
  37.  
  38.         char    *temp    =    GetTEXT( ((int)FormationInfo[Team] + FORM_LIST ));
  39.  
  40.         Image_Widths[INFO_NBAR+Lft]    =    Image_Widths[INFO_NBAR+Rgt]+FORMATION_BAR_WIDTH;
  41.  
  42.  
  43. //        DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  44. //                INFO_NBAR+Lft, NameBarXposn, 426, FORMATION_infoBOX, spritecopy );  
  45. //        DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN, 
  46. //                INFO_NBAR+Lft, NameBarXposn, 426, FORMATION_infoBOX, spritecopy );  
  47. //        DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  48. //                INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft], 
  49. //                    426, FORMATION_infoBOX, spritecopy );  
  50.  
  51. //        if (Bounding_table[FORMATION_stringBOX].BoundingBoxLeft != -1 )
  52. //
  53. //            CopyFromBACKtoPSEUDObuffer(
  54. //                &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  55. //                Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  56. //                Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  57. //                 Bounding_table[FORMATION_stringBOX].BoundingBoxRight  - 
  58. //                 Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  59. //                 Bounding_table[FORMATION_stringBOX].BoundingBoxBottom - 
  60. //                 Bounding_table[FORMATION_stringBOX].BoundingBoxTop);
  61. //
  62.  
  63.         DisplayString( NameBarXposn+38,            //Image_Widths[INFO_NBAR+Lft]-48,
  64.                 430, &temp[0],
  65.                 LARGE_FONT, 62, 
  66.                 FORMATION_stringBOX, 
  67.                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  68.  
  69.         AddToDumpList(     Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  70.                 Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  71.                  Bounding_table[FORMATION_stringBOX].BoundingBoxRight  - 
  72.                  Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  73.                  Bounding_table[FORMATION_stringBOX].BoundingBoxBottom - 
  74.                  Bounding_table[FORMATION_stringBOX].BoundingBoxTop);
  75.  
  76.  
  77.  
  78.     // ******  DISPLAY FORMATION LOTTO BALLS ONTO FORMATION PITCH  *****
  79.     
  80.           for ( signed int s=9; s>-1; s -- )
  81.         {
  82.             player    =    (SquadInfo[(Team*20)+(s+1) ]);
  83.             ball    =    player+FORM_IMGS;
  84.  
  85.                 // get y-coord of ball.
  86.  
  87.             ysize    =    ((float) PITCH_YPOS_BL-PITCH_YPOS_TL);           // size of formation pitch in y.
  88.             yscale    =    (1280/2) / ysize;                    // scale down tactic y pos.
  89.             y    =    (float) (TeamTactics[ (32*2)+5 ][s][0] / yscale );     // get actual formation y pos.
  90.  
  91.                 // get x difference for each y pixel up formation pitch. (0.829114).
  92.  
  93.             xdiff    =    ( (float) (((PITCH_XPOS_BR-PITCH_XPOS_BL) - (PITCH_XPOS_TR-PITCH_XPOS_TL)) / ysize));             
  94.             wthscale=    ( (float) ( (PITCH_XPOS_BR-PITCH_XPOS_BL) - ((int)y) * xdiff) );                    
  95.                 
  96.                 // calculate x scale for each pixel.
  97.                 
  98.             xscale    =    ( (float) ( (PITCH_XPOS_BR-PITCH_XPOS_BL) / wthscale) );
  99.  
  100.                 // calculate converted formation x-coord.
  101.  
  102.             
  103.             if ( (TeamTactics[ (32*2)+5 ][s][1] & 31) > 15 )
  104.                 snapx    =  ( (TeamTactics[ (32*2)+5 ][s][1] & 0xffe0) +32 );
  105.             else
  106.                 snapx    =  (TeamTactics[ (32*2)+5 ][s][1] & 0xffe0);
  107.  
  108.             x    =    (float) ( (snapx / ( 800.0 / (PITCH_XPOS_BR-PITCH_XPOS_BL) ) )
  109.                                 / xscale );
  110.  
  111.             bscale    =    ( (ysize-y) / (    ( PITCH_YPOS_BL - PITCH_YPOS_TL ) /6) );
  112.             ball+=      (bscale*20);
  113.  
  114.             shadow    =    FBAL_SHDS+bscale;
  115.  
  116.             shady    =    ( (ysize-y)+PITCH_YPOS_TL );
  117.             y    =    shady - Image_Heights[ball];
  118.             x    =    ( x+PITCH_XPOS_BL) - (Image_Widths[ball] /2 );
  119.             x    =    ( x+ ((PITCH_XPOS_BR-PITCH_XPOS_BL) - (wthscale)) /2 );
  120.  
  121.  
  122.             shady+=        (Image_Heights[shadow]/2);
  123.  
  124.             DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  125.                    shadow, 
  126.                    (int)x, (int)shady, s+21, 
  127.                    spritefilter);      // shadow filter for formation lotto balls.
  128.  
  129.             DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  130.                    ball, 
  131.                    (int)x, (int)y, s+21, 
  132.                    spritecopy );      // formation lotto balls.
  133.  
  134.             if ( AddToList != NULL )
  135.             {
  136.                 width    = Bounding_table[s+21].BoundingBoxRight  - 
  137.                     Bounding_table[s+21].BoundingBoxLeft;
  138.                 height    = Bounding_table[s+21].BoundingBoxBottom - 
  139.                     Bounding_table[s+21].BoundingBoxTop;
  140.                 AddToDumpList( 
  141.                     Bounding_table[s+21].BoundingBoxLeft,
  142.                     Bounding_table[s+21].BoundingBoxTop,
  143.                     width, height );
  144.             }
  145.         }
  146.  
  147.     player    =    (SquadInfo[(Team*20)]);
  148.     ball    =    player+FORM_IMGS+(5*20);
  149.  
  150.     DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  151.            FBAL_SHDS+5,
  152.            (int) ((PITCH_XPOS_BR-PITCH_XPOS_BL)/2) - (Image_Widths[ball] /2) + PITCH_XPOS_BL,
  153.            (int) PITCH_YPOS_BR-8+(Image_Heights[FBAL_SHDS+5]/2), 
  154.            32, 
  155.            spritefilter);
  156.  
  157.     DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, 
  158.            ball, 
  159.            (int) ((PITCH_XPOS_BR-PITCH_XPOS_BL)/2) - (Image_Widths[ball] /2) + PITCH_XPOS_BL,
  160.            (int) PITCH_YPOS_BR-8-Image_Heights[ball], 
  161.            32, 
  162.            spritecopy );      
  163.  
  164.     }
  165.  
  166. //********************************************************************************************************************************
  167.  
  168. void    ClearFormationMarkers()
  169.     {
  170.         short    width;
  171.         short    height;
  172.    
  173.               for ( int b=21; b < 33; b++ )
  174.             {
  175.             width    = Bounding_table[b].BoundingBoxRight  - 
  176.                     Bounding_table[b].BoundingBoxLeft;
  177.             height    = Bounding_table[b].BoundingBoxBottom - 
  178.                     Bounding_table[b].BoundingBoxTop;
  179.             CopyFromBACKtoPSEUDObuffer(
  180.                 &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  181.                 Bounding_table[b].BoundingBoxLeft,
  182.                 Bounding_table[b].BoundingBoxTop,
  183.                 width, height );
  184.  
  185.             AddToDumpList( 
  186.                 Bounding_table[b].BoundingBoxLeft,
  187.                 Bounding_table[b].BoundingBoxTop,
  188.                 width, height );
  189.  
  190.             Bounding_table[b].BoundingBoxLeft    =    -1;
  191.             Bounding_table[b].BoundingBoxRight    =    -1;
  192.             Bounding_table[b].BoundingBoxTop    =    -1;
  193.             Bounding_table[b].BoundingBoxBottom    =    -1;
  194.             }
  195.  
  196.          width    = Bounding_table[FORMATION_stringBOX].BoundingBoxRight  - 
  197.                Bounding_table[FORMATION_stringBOX].BoundingBoxLeft;
  198.          height    = Bounding_table[FORMATION_stringBOX].BoundingBoxBottom - 
  199.                Bounding_table[FORMATION_stringBOX].BoundingBoxTop;
  200.         CopyFromBACKtoPSEUDObuffer(
  201.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  202.             Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  203.             Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  204.             width, height );
  205.         AddToDumpList( 
  206.             Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  207.             Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  208.             width, height );
  209.     }
  210.                 
  211. //********************************************************************************************************************************
  212.  
  213.     int FormationLabels[]={
  214.  
  215.     // 3-1-6
  216.  
  217.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  218.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  219.         
  220.     // 4-0-6                     
  221.  
  222.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  223.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  224.         
  225.     // 4-1-5                     
  226.  
  227.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  228.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  229.         
  230.     // 4-2-4                     
  231.  
  232.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  233.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  234.         
  235.     // 4-3-3                     
  236.  
  237.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  238.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  239.         
  240.     // 4-4-2                     
  241.  
  242.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Fw,  
  243.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  244.         
  245.     // 5-1-4                     
  246.  
  247.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  248.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  249.         
  250.     // 5-2-3                     
  251.  
  252.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw,  
  253.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  254.         
  255.     // 5-3-2                     
  256.  
  257.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Fw,  
  258.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  259.         
  260.     // 6-3-1                     
  261.  
  262.     FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md,  
  263.     FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, 
  264.         
  265.                 };
  266.  
  267. void    DisplayPositionLabels()
  268.     {
  269.         char    *string;
  270.         short    PlyrIndex, Plyr;
  271.  
  272.           for ( char s=0; s < 20; s ++ )
  273.         {
  274.             PlyrIndex = NormalisePlayer( s, Team );
  275.  
  276.         // get field position label if nessesary.
  277.  
  278.                 string  =  GetTEXT ( FRPS_LBLE+Dr );
  279.  
  280.         // get substitute label if nessesary.
  281.  
  282.             if ( s < (11+NoOfSubs) )
  283.             string    =  GetTEXT ( FormationLabels[ (s+(20*FormationInfo[Team])) ] );
  284.  
  285.         // get injured label if nessesary.
  286.  
  287.             if ( Fitness[PlyrIndex] < Injured )
  288.                 string  =  GetTEXT ( FRPS_LBLE+In );
  289.  
  290.         // get banned label if nessesary.
  291.  
  292.             if ( DiscPts[PlyrIndex] > 1 )
  293.                 string  =  GetTEXT ( FRPS_LBLE+Bn );
  294.  
  295.                DisplayString( 497-(PixelLengthOfString( string , SMALL_FONT) ) /2, 
  296.                     (103+(s*18)), string, 
  297.                     SMALL_FONT, SELECT_COLOUR, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  298.         }
  299.           }
  300.  
  301. //********************************************************************************************************************************
  302.  
  303. void    DisplaySquad()
  304.     {
  305.         int    PAL;
  306.         short    PlyrIndex;
  307.  
  308.               DisplayPositionLabels();
  309.  
  310.           for ( char s=0; s < 20; s ++ )
  311.         {
  312.             PlyrIndex =    NormalisePlayer( s, Team );
  313.  
  314.             if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  315.                 PAL    =  SELECT_COLOUR;
  316.             else
  317.                 PAL    =    48;
  318.  
  319.             DisplayString( (500+21)-(PixelLengthOfString( GetTEXT( SQUD_NMBS+SquadInfo[ (Team*20)+s ]) ,SMALL_FONT) ) /2, 
  320.                  (103+(s*18)), ( GetTEXT (SQUD_NMBS+SquadInfo[ (Team*20)+s ])) , 
  321.                  SMALL_FONT, 24, s, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  322.  
  323.             DisplayString( (515+21),(103+(s*18)), 
  324.                      ( GetPLAYERSname( SquadInfo[ (Team*20)+s ], Team, INITIAL_SURNAME )) , 
  325.                     SMALL_FONT, PAL, s, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  326.  
  327.             Bounding_table[s].BoundingBoxRight    =    639;
  328.  
  329.             MarkPlayer        =    -1;
  330.             SquadBuffer1yposn    =    -1;
  331.         }
  332.     }
  333.  
  334. //********************************************************************************************************************************
  335.  
  336. void    DoSquadSelection( char MENU, signed char BOX, short xposn, short yposn )
  337.     {
  338.         if ( (MENU == SQUAD_SELECT || MENU == PLAYER_STATS) && LogicState == RUN_FRONTEND)
  339.         {
  340.                 // display name of player being dragged into new position
  341.  
  342.             if (MarkPlayer!=-1)
  343.             {
  344.                 SetupMouseLimits( 472, 626, 16, 452 );
  345.  
  346.                 if ( ButtonState!=0 && ( BOX==MarkPlayer || BOX==-1 ) )
  347.                 {            
  348.                     RedrawSquadPanel();
  349.                      MarkPlayer    =    -1;
  350.                          DeBounce      =     TRUE;
  351.                 }
  352.             }
  353.  
  354.             else
  355.                 SetupMouseLimits( 0, 626, 1, 452 );
  356.  
  357.  
  358.             if ( MarkPlayer != -1 )
  359.                 {
  360.                 SquadBuffer1yposn    =    yposn-6;
  361.  
  362.                 StorePSEUDObuffer( &FrontendPseudoDEFN, &FrontendTextureDEFN, DRAG_STOREbuff, 515, SquadBuffer1yposn );
  363.  
  364.                 DisplayString( 515+21, SquadBuffer1yposn, 
  365.                      ( GetPLAYERSname( SquadInfo[ (Team*20)+MarkPlayer ], Team, INITIAL_SURNAME )) , 
  366.                     SMALL_FONT, MOVE_COLOUR, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  367.                           
  368.                     AddToDumpList( 515, SquadBuffer1yposn,
  369.                     Image_Widths[DRAG_STOREbuff], Image_Heights[DRAG_STOREbuff] 
  370.                     );
  371.                        }
  372.  
  373.                 // ***  choose a player from squad list.  ***
  374.             
  375.             if ( (MarkPlayer == -1) && (BOX != NO_BOX) && (BOX < 20) && (ButtonState==LEFT_BUTTON) )
  376.                 {
  377.                      MarkPlayer    =    BOX;
  378.  
  379.                     DisplayString( 515+21, (103+(MarkPlayer*18)), 
  380.                          ( GetPLAYERSname( SquadInfo[ (Team*20)+MarkPlayer ], Team, INITIAL_SURNAME )) , 
  381.                         SMALL_FONT, SELECT_COLOUR, MarkPlayer, &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  382.                     AddToDumpList( 515+21, (103+(MarkPlayer*18)), 149, 18 );
  383.                          DeBounce      =     TRUE;
  384.                 }                                     
  385.                
  386.             else    
  387.  
  388.             if (MarkPlayer != -1 && ButtonState == RIGHT_BUTTON && BOX < 20 )
  389.  
  390.             {
  391.                 RedrawSquadPanel();
  392.                 MarkPlayer      =  -1;
  393.                 SquadBuffer1yposn =  -1;
  394.                 ButtonState      =  0;
  395.                      DeBounce        =  TRUE;
  396.             }
  397.                 
  398.  
  399.         // Stop User From Viewing Stats Of Player Already Displayed
  400.  
  401.                    if ( MarkPlayer != -1 && (NormalisePlayer(MarkPlayer, Team)) == ViewPlyrStats 
  402.                 && yposn<100 && MENU == PLAYER_STATS)
  403.             {
  404.                     ReplaceSquadBuffers(Menu);
  405.                     RedrawSquadPanel();
  406.                     MarkPlayer      =  -1;
  407.             }            
  408.  
  409.  
  410.             if ( MarkPlayer != -1  && 
  411.                  BOX != NO_BOX     && 
  412.                  BOX < 20            && 
  413.                  BOX != MarkPlayer &&
  414.                  ButtonState==LEFT_BUTTON )
  415.             {
  416.                  short PlyrIndex1 =    NormalisePlayer( BOX, Team );
  417.                  short PlyrIndex2 =    NormalisePlayer( MarkPlayer, Team );
  418.     
  419.                 if ( DiscPts[ PlyrIndex1 ] < 2 && 
  420.                      DiscPts[ PlyrIndex2 ] < 2 &&
  421.                      Fitness[ PlyrIndex1 ] > Injured &&    
  422.                      Fitness[ PlyrIndex2 ] > Injured )
  423.                 {
  424.                     char p;
  425.                     p                    =    SquadInfo[ (Team*20)+MarkPlayer ];
  426.                     SquadInfo[ (Team*20)+MarkPlayer ]    =    SquadInfo[ (Team*20)+BOX ];
  427.                     SquadInfo[ (Team*20)+BOX ]        =    p;
  428.                     RedrawSquadPanel();
  429.                     MarkPlayer        =    -1;
  430.                     SquadBuffer1yposn    =    -1;
  431.                          DeBounce      =     TRUE;
  432.  
  433.                     if ( MENU == SQUAD_SELECT )
  434.                     {
  435.                         ClearFormationMarkers();
  436.                         DisplayFormation( NULL );
  437.                     }
  438.                 }
  439.             }                                     
  440.  
  441.             
  442.             if ( BOX == OPPONENT_TEAM_BOX && ButtonState!=0 && MENU == SQUAD_SELECT )
  443.                 {
  444.                     EUROteamView++;
  445.                     Team    =    ConfigureTeamView();
  446.  
  447.                     if ( ButtonState != 0 )
  448.                         Animation_table[ViewTeamHandle].AnimationSpeed =
  449.                             WhichButton( ButtonState, 1.25);
  450.                     ChangeMenu    =    SQUAD_SELECT;
  451.                          DeBounce      =     TRUE;
  452.                 }                                     
  453.  
  454.             if ( (BOX == QUESTION_BOX && MarkPlayer != -1 && ButtonState!=0 && MENU == SQUAD_SELECT) ||
  455.                  (BOX == QUESTION_BOX && MarkPlayer != -1 && 
  456.                   (NormalisePlayer(MarkPlayer, Team)) != ViewPlyrStats && ButtonState!=0 
  457.                    && MENU == PLAYER_STATS) )
  458.                  
  459.                 {
  460.                     ViewPlyrStats     =    NormalisePlayer( MarkPlayer, Team );
  461.                     ChangeMenu    =    PLAYER_STATS;
  462.                          DeBounce      =     TRUE;
  463.                 }                                     
  464.  
  465.  
  466.             if ( (BOX == QUESTION_BOX && MarkPlayer == -1 && ButtonState!=0 && MENU == SQUAD_SELECT) ||
  467.                  (BOX == QUESTION_BOX && MarkPlayer == -1 && ButtonState!=0 && MENU == PLAYER_STATS) )
  468.                 {
  469.                     EUROstatTeam    =    Team;
  470.                     ChangeMenu    =    TEAM_STATS;
  471.                          DeBounce      =     TRUE;
  472.                 }                                     
  473.  
  474.             if ( BOX == FORMATION_BOX && ButtonState != 0 && MENU == SQUAD_SELECT )
  475.                 {
  476.                     ClearFormationMarkers();
  477.  
  478.                     if ( ButtonState == LEFT_BUTTON )
  479.                         FormationInfo[Team]--;
  480.                     else
  481.                         FormationInfo[Team]++;
  482.  
  483.                     if ( FormationInfo[Team] < 0 )                    
  484.                         FormationInfo[Team] = 9;
  485.                     if ( FormationInfo[Team] > 9 )                    
  486.                         FormationInfo[Team] = 0;
  487.  
  488.                     LoadTactics( ((int)FormationInfo[Team]), "..\\data\\euro.dat", &TeamTactics[0][0][0] );
  489.                     DisplayFormation( 1 );
  490.  
  491.  
  492.                     CopyFromBACKtoPSEUDObuffer(
  493.                         &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  494.                         484, 102, 25, 361 );
  495.                     AddToDumpList( 488, 102, 25, 361 );
  496.  
  497.                     DisplayPositionLabels();
  498.                     
  499.                     if ( ButtonState == LEFT_BUTTON )
  500.                         Animation_table[FormationHandle].AnimationSpeed = -1.25;
  501.                     else
  502.                         Animation_table[FormationHandle].AnimationSpeed = 1.25;
  503.  
  504.                      MarkPlayer    =    -1;
  505.                          DeBounce      =     TRUE;
  506.                 }                                     
  507.  
  508.  
  509.             if ( BOX == RETURN_SQUAD_BOX && ButtonState != 0 && MENU == SQUAD_SELECT )
  510.                 {
  511.  
  512.                     Animation_table[ReturnSqdHandle].AnimationSpeed = 
  513.                         WhichButton( ButtonState, 1.25);
  514.                          DeBounce      =     TRUE;
  515.  
  516.                     if ( EUROgameType != EURO_championship )
  517.                         ChangeMenu    =    TEAM_SELECT;
  518.                     else
  519.                         ChangeMenu    =    NEXT_MATCH;
  520.  
  521.                 }                                     
  522.         }
  523.     }
  524.  
  525. //********************************************************************************************************************************
  526.  
  527. void    RedrawSquadPanel()
  528.     {
  529.         CopyFromBACKtoPSEUDObuffer(
  530.             &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  531.             488+21, 100, 131, 364 );
  532.         DisplaySquad();
  533.         AddToDumpList( 488+21, 100, 131, 364 );
  534.     }
  535.  
  536. //********************************************************************************************************************************
  537.  
  538. void    ReplaceSquadBuffers( char MENU )
  539.     {
  540.         if ( MENU == SQUAD_SELECT || MENU == PLAYER_STATS )
  541.         {
  542.             if ( SquadBuffer1yposn!=-1 )
  543.             {
  544.  
  545.                       DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, DRAG_STOREbuff, 515, 
  546.                         SquadBuffer1yposn, NO_BOX, straightcopy );
  547.  
  548.                 AddToDumpList(
  549.                 515,
  550.                 SquadBuffer1yposn,
  551.                 Image_Widths[DRAG_STOREbuff], 
  552.                 Image_Heights[DRAG_STOREbuff] 
  553.                 );
  554.                 SquadBuffer1yposn    =    -1;
  555.             }
  556.         }
  557.  
  558.     }
  559.  
  560. //********************************************************************************************************************************
  561.  
  562. void    DoInjuriesAndMatchBans( char GAMEtype, char Team )
  563.     {
  564.         char    LastPlyr, Swapped;
  565.         short    PlyrIndex, Plyr;
  566.  
  567. //        if ( GAMEtype == EURO_championship )
  568.         {
  569.             LastPlyr = 19;
  570.             Swapped     = 1;
  571.             
  572.             while    ( Swapped !=0 )
  573.             {        
  574.  
  575.                 // **** Find A Spot At The End Of The Squad List For Player To Be Swapped Into ****
  576.  
  577.                 PlyrIndex =    NormalisePlayer( LastPlyr, Team );
  578.  
  579.                 if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  580.                 {
  581.                   LastPlyr--;
  582.                   if ( LastPlyr < 1 )    // **** checked all available players so bomb out and leave player 
  583.                     Swapped = 0;    //      were he is ****
  584.                 }
  585.             
  586.                 else
  587.  
  588.  
  589.                 {            
  590.                   for ( char s=0; s < 11; s ++ )
  591.                   {
  592.                     Swapped = 0;
  593.                     PlyrIndex =    NormalisePlayer( s, Team );
  594.  
  595.                     if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  596.                     {
  597.                       char p = SquadInfo[ (Team*20)+s ];
  598.                       SquadInfo[ (Team*20)+s ] = SquadInfo[ (Team*20)+LastPlyr ];
  599.                       SquadInfo[ (Team*20)+LastPlyr ] =    p;
  600.                       Swapped = 1;
  601.                                         
  602.                 // **** Was This An Ideal Swap ****                    
  603.  
  604. //                      if ( PlayerPosns[ (Team*20)+s ] != PlayerPosns[ (Team*20)+LastPlyr ] )
  605. //                      {
  606. //                      }
  607.  
  608.  
  609.  
  610.  
  611.                     }                        
  612.                   }
  613.                 }
  614.             }
  615.         }
  616.     }
  617.     
  618. //********************************************************************************************************************************
  619.  
  620.